package com.livedocumentation.client.web.comments;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.livedocumentation.client.facebook.FacebookImage;
import com.livedocumentation.client.model.Comment;

/**
 * 
 * @Feature
 */
public class CommentsList extends VerticalPanel {

	public CommentsList(ArrayList<Comment> comments) {

		for (Comment comment : comments) {

			HorizontalPanel feed = new HorizontalPanel();

			feed.setSpacing(7);

			feed.add(new FacebookImage(comment.getFacebookUser()
					.getFacebookID(), comment.getFacebookUser()
					.getFacebookName()));

			feed.add(getFeedDescription(comment.getDescription()));

			this.add(feed);
		}
	}

	private HTML getFeedDescription(String feedDescription) {

		HTML name = new HTML(feedDescription);
		name.setWidth("300px");

		return name;
	}

}
